<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-susdDetail-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">补助类型：</label>
				<div class="col-sm-8">
					<select id="sudeType" class="form-control m-b" th:with="type=${@dict.getType('pm_susd_type')}">
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
	                </select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">补助天数：</label>
				<div class="col-sm-8">
					<input id="sudeDays" name="sudeDays" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">补助金额：</label>
				<div class="col-sm-8">
					<input id="sudeAmount" name="sudeAmount" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">证件号码：</label>
				<div class="col-sm-8">
					<input id="empId" name="empId" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">姓名：</label>
				<div class="col-sm-8">
					<input id="empNm" name="empNm" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">考勤天数：</label>
				<div class="col-sm-8">
					<input id="signDays" name="signDays" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">加班类型：</label>
				<div class="col-sm-8">
					<select id="wowType" class="form-control m-b" th:with="type=${@dict.getType('pm_wow_type')}">
					    <option value="">请选择...</option>
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
	                </select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">说明：</label>
				<div class="col-sm-8">
					<input id="sudeNote" name="sudeNote" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">补助主键：</label>
				<div class="col-sm-8">
					<input id="susdId" name="susdId" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "pm/susdDetail";
		$("#form-susdDetail-add").validate({
			rules:{
				empId:{
					required:true,
				},
				empNm:{
					required:true,
				},
				signDays:{
					required:true,
				}
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	add();
	        }
	    }
		
		function add() {
        	var sudeType = $("#sudeType option:selected").val();
        	var wowType = $("#wowType option:selected").val();
        	var sudeDays = $("input[name='sudeDays']").val();
        	var sudeAmount = $("input[name='sudeAmount']").val();
        	var empId = $("input[name='empId']").val();
        	var empNm = $("input[name='empNm']").val();
        	var signDays = $("input[name='signDays']").val();
        	var sudeNote = $("input[name='sudeNote']").val();
        	var susdId = $("input[name='susdId']").val();
        	$.ajax({
        		cache : true,
        		type : "POST",
        		url : ctx + "pm/susdDetail/add",
        		data : {
        			"sudeType": sudeType,
        			"wowType": wowType,
        			"sudeDays": sudeDays,
        			"sudeAmount": sudeAmount,
        			"empId": empId,
        			"empNm": empNm,
        			"signDays": signDays,
        			"sudeNote": sudeNote,
        			"susdId": susdId
        		},
        		async : true,
        		error : function(request) {
        			$.modal.alertError("系统错误");
        		},
        		success : function(data) {
        			$.operate.saveSuccess(data);
        		}
        	});
        }
	</script>
</body>
</html>
